﻿using Sustainalytics.Common.Configuration;
using System.Configuration;

namespace Sustainalytics.Events.Service
{
    public class EventsConfiguration : HostConfigurationSection
    {
        public const string DefaultEventsSectionName = "sustainalytics/events";
        public static EventsConfiguration GetDefaultConfiguration() 
        {
            var eventsConfiguration = (EventsConfiguration)System.Configuration.ConfigurationManager.GetSection(DefaultEventsSectionName);
            if (eventsConfiguration.Host != null)
            {
                #if !DEBUG
                eventsConfiguration.Host.Secured = true;
                #endif
            }

            return eventsConfiguration;
        }

        [ConfigurationProperty("dbConfiguration", IsRequired = true)]
        public DbConfigurationElement DbConfiguration
        {
            get { return (DbConfigurationElement)this["dbConfiguration"]; }
        }

    }
}
